C51 COMPILER V9.60.0.0   MAIN                                                              03/23/2023 11:54:16 PAGE 1   


C51 COMPILER V9.60.0.0, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\Release\main.obj
COMPILER INVOKED BY: C:\Keil_v5\C51\BIN\C51.EXE main.c OPTIMIZE(0,SPEED) REGFILE(.\Release\Sample_DrvEINT.ORC) BROWSE IN
                    -CDIR(..\..\..\..\C51SIS\C51;..\..\..\Include\Driver) DEBUG OBJECTEXTEND TABS(2) OBJECT(.\Release\main.obj)

line level    source

   1          /**************************************************************************//**
   2           * @file           main.c
   3           * @version        V1.0
   4           * $Revision:      1 $
   5           * $Date:          2017/01/04 $
   6           * @brief          Main function
   7           * @Author         Jeffrey Kang
   8           * @ContactInfo    chkang@esmt.com.tw
   9           *
  10           * @note
  11           *
  12           * Copyright (C) 1998 Elite Semiconductor Memory Technology Corp.
  13           * All rights reserved.
  14           *
  15           ******************************************************************************/
  16          
  17          
  18          #include <REG52.h>
  19          #include "system_FE81001.h"
  20          
  21          
  22          /**
  23           * @brief       delay function
  24           *
  25           * @param       None
  26           *
  27           * @return      None
  28           *
  29           * @details     1. 
  30           */
  31          void delay( void )
  32          {
  33   1        unsigned int i;
  34   1        
  35   1        for( i = 0 ; i < 2000 ; i++ ){}
  36   1      }
  37          
  38          
  39          /**
  40           * @brief       EINT3ISR function
  41           *
  42           * @param       None
  43           *
  44           * @return      None
  45           *
  46           * @details     1. 
  47           */
  48          const void EINT3ISR (void) interrupt ISR_EINT3
  49          {
  50   1        unsigned char int_stat = INTC->eint_stat;
  51   1        
  52   1        if ((int_stat & 0x08) == 0x08)
  53   1          INTC->eint_stat = 0x08;
  54   1        
C51 COMPILER V9.60.0.0   MAIN                                                              03/23/2023 11:54:16 PAGE 2   

  55   1          PD1=~PD1;
  56   1        
  57   1        /* enable global interrupt */
  58   1        INTC->int_gmask = 0x01;
  59   1      }
  60          
  61          
  62          /**
  63           * @brief       EINT2ISR function
  64           *
  65           * @param       None
  66           *
  67           * @return      None
  68           *
  69           * @details     1. 
  70           */
  71          const void EINT2ISR (void) interrupt ISR_EINT2
  72          {
  73   1        unsigned char int_stat = INTC->eint_stat;
  74   1        
  75   1        if ((int_stat & 0x04) == 0x04)
  76   1          INTC->eint_stat = 0x04;
  77   1        
  78   1        PD1=~PD1;
  79   1        
  80   1        /* enable global interrupt */
  81   1        INTC->int_gmask = 0x01;
  82   1      }
  83          
  84          
  85          /**
  86           * @brief       EINT1ISR function
  87           *
  88           * @param       None
  89           *
  90           * @return      None
  91           *
  92           * @details     1. 
  93           */
  94          const void EINT1ISR (void) interrupt ISR_EINT1
  95          {
  96   1        unsigned char int_stat = INTC->eint_stat;
  97   1        
  98   1        if ((int_stat & 0x02) == 0x02)
  99   1          INTC->eint_stat = 0x02;
 100   1        
 101   1        PD1=~PD1;
 102   1        
 103   1        /* enable global interrupt */
 104   1        INTC->int_gmask = 0x01;
 105   1      }
 106          
 107          
 108          /**
 109           * @brief       EINT0ISR function
 110           *
 111           * @param       None
 112           *
 113           * @return      None
 114           *
 115           * @details     1. 
 116           */
C51 COMPILER V9.60.0.0   MAIN                                                              03/23/2023 11:54:16 PAGE 3   

 117          const void EINT0ISR (void) interrupt ISR_EINT0
 118          {
 119   1        unsigned char int_stat = INTC->eint_stat;
 120   1        
 121   1        if ((int_stat & 0x01) == 0x01)
 122   1          INTC->eint_stat = 0x01;
 123   1        
 124   1        PD1=~PD1;
 125   1        
 126   1        /* enable global interrupt */
 127   1        INTC->int_gmask = 0x01;
 128   1      }
 129          
 130          
 131          /**
 132           * @brief       EINT3Init function
 133           *
 134           * @param       None
 135           *
 136           * @return      None
 137           *
 138           * @details     1. 
 139           */
 140          void EINT3Init(void)
 141          {
 142   1        /* enable PA.2 input */
 143   1        PORT_SetPAInput(BIT2);
 144   1        
 145   1        /* enable PA.2 EINT function */
 146   1        Set_PA2_EINT3();
 147   1        
 148   1        /* enable PA.2 falling & low interrupt_ */
 149   1        //Set_EINT3_Falling_and_Low();
 150   1        
 151   1        /* enable PA.2 rising interrupt_ */
 152   1        //Set_EINT3_Rising();
 153   1        
 154   1        /* enable PA.2 falling interrupt_*/
 155   1        Set_EINT3_Falling();
 156   1        
 157   1        /* enable PA.2 rising & falling interrupt_ */
 158   1        //Set_EINT3_Rising_and_Falling();
 159   1        
 160   1        /* enable PA.2 interrupt_ */
 161   1        Enable_EINT3_interrupt();
 162   1        
 163   1      }
 164          
 165          
 166          /**
 167           * @brief       EINT2Init function
 168           *
 169           * @param       None
 170           *
 171           * @return      None
 172           *
 173           * @details     1. 
 174           */
 175          void EINT2Init(void)
 176          {
 177   1        /* enable PA.3 input */
 178   1        PORT_SetPAInput(BIT3);
C51 COMPILER V9.60.0.0   MAIN                                                              03/23/2023 11:54:16 PAGE 4   

 179   1        
 180   1        /* enable PA.3 EINT function */
 181   1        Set_PA3_EINT2();
 182   1        
 183   1        /* enable PA.3 falling & low interrupt_ */
 184   1        //Set_EINT2_Falling_and_Low();
 185   1        
 186   1        /* enable PA.3 rising interrupt_ */
 187   1        //Set_EINT2_Rising();
 188   1        
 189   1        /* enable PA.3 falling interrupt_ */
 190   1        Set_EINT2_Falling();
 191   1        
 192   1        /* enable PA.3 rising & falling interrupt_ */
 193   1        //Set_EINT2_Rising_and_Falling();
 194   1        
 195   1        /* enable PA.3 interrupt_ */
 196   1        Enable_EINT2_interrupt();
 197   1      }
 198          
 199          
 200          /**
 201           * @brief       EINT1Init function
 202           *
 203           * @param       None
 204           *
 205           * @return      None
 206           *
 207           * @details     1. 
 208           */
 209          void EINT1Init(void)
 210          {
 211   1        /* enable PA.5 input */
 212   1        PORT_SetPAInput(BIT5);
 213   1        
 214   1        /* enable PA.5 EINT function */
 215   1        Set_PA5_EINT1();
 216   1        
 217   1        /* enable PA.5 falling & low interrupt_ */
 218   1        //Set_EINT1_Falling_and_Low();
 219   1        
 220   1        /* enable PA.5 rising interrupt_ */
 221   1        //Set_EINT1_Rising();
 222   1        
 223   1        /* enable PA.5 falling interrupt_ */
 224   1        Set_EINT1_Falling();
 225   1        
 226   1        /* enable PA.5 rising & falling interrupt_ */
 227   1        //Set_EINT1_Rising_and_Falling();
 228   1        
 229   1        /* enable PA.5 interrupt */
 230   1        Enable_EINT1_interrupt();
 231   1        
 232   1      }
 233          
 234          
 235          /**
 236           * @brief       EINT0Init function
 237           *
 238           * @param       None
 239           *
 240           * @return      None
C51 COMPILER V9.60.0.0   MAIN                                                              03/23/2023 11:54:16 PAGE 5   

 241           *
 242           * @details     1. 
 243           */
 244          void EINT0Init(void)
 245          {
 246   1        /* enable PB.3 input */
 247   1        PORT_SetPBInput(BIT3);
 248   1        
 249   1        /* enable PB.3 EINT function */
 250   1        Set_PB3_EINT0();
 251   1        
 252   1        /* enable PB.3 falling & low interrupt_ */
 253   1        //Set_EINT0_Falling_and_Low();
 254   1        
 255   1        /* enable PB.3 rising interrupt_ */
 256   1        //Set_EINT0_Rising();
 257   1        
 258   1        /* enable PB.3 falling interrupt_ */
 259   1        Set_EINT0_Falling();
 260   1        
 261   1        /* enable PB.3 rising & falling interrupt_ */
 262   1      //  Set_EINT0_Rising_and_Falling();
 263   1        
 264   1        /* enable PB.3 interrupt_ */
 265   1        Enable_EINT0_interrupt();
 266   1      }
 267          
 268          
 269          /**
 270           * @brief       main function
 271           *
 272           * @param       None
 273           *
 274           * @return      None
 275           *
 276           * @details     1. 
 277           */
 278          int main( void )
 279          {
 280   1        /* enable GPIO clock */
 281   1        PORT_PAPBPCPD_Clock_Enable();                       // enable GPIOA GPIOB GPIOC GPIOD clock
 282   1        
 283   1        /* Set PC7 input as button */
 284   1        PORT_SetPCInput(BIT7);
 285   1      
 286   1        /* Set PD1. ,PD2.,PD3 output */
 287   1        PORT_SetPDPushPull(BIT1 | BIT2 | BIT3 );
 288   1      
 289   1      
 290   1        PD1 = 0; // LED_G1 On
 291   1        PD2 = 1 ; //LED_R Off
 292   1        PD3= 0;  // LED_G2  On
 293   1        
 294   1        /* enable external interrupt_ sampling clock */
 295   1        //Set_EINT_ClockSource_LSRC();                                // external interrupt_ sampling source clock = lsrc 
 296   1        
 297   1        /*enable external interrupt_ sampling source clock*/
 298   1        En_EINT_clk();                                                          
 299   1        
 300   1        /* enable EINT0 function */
 301   1        EINT0Init();
 302   1        
C51 COMPILER V9.60.0.0   MAIN                                                              03/23/2023 11:54:16 PAGE 6   

 303   1        /* enable EINT1 function */
 304   1        //EINT1Init();
 305   1        
 306   1        /* enable EINT2 function */
 307   1        //EINT2Init();
 308   1        
 309   1        /* enable EINT3 function */
 310   1        //EINT3Init();
 311   1        
 312   1        /* enable global interrupt */
 313   1        INTC->int_gmask = 0x01;
 314   1        
 315   1        while(1)
 316   1        {
 317   2          if( Get_PCx_input(7) == 0)   // PC7  = 0 , button down
 318   2            {
 319   3                PD2 = 0 ; //LED_R On
 320   3            }
 321   2            else
 322   2            {
 323   3                PD2 = 1 ; //LED_R Off
 324   3            }
 325   2        }
 326   1      }
 327          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    828    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      6    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
